<extend name="extends/extend" />
<block name="loadCss">
    <!--美化 checkbox radio css-->
    <link href="__admin__/css/plugins/iCheck/custom.css" rel="stylesheet">
</block>
<block name="script">
    <!--美化 checkbox radio js-->
    <script src="__admin__/js/plugins/iCheck/icheck.min.js"></script>
    <!--表单验证 插件-->
    <script src="__admin__/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="__admin__/js/plugins/validate/messages_zh.min.js"></script>
    <script>
       $(document).ready(function () {
           $(".i-checks").iCheck({
               checkboxClass:"icheckbox_square-green",
               radioClass:"iradio_square-green",
           });
            $('#checkForm').validate({
                submitHandler:function(form) {
                    form.submit();
                },
                highlight: function(e) {
                    $(e).closest(".form-group").removeClass("has-success").addClass("has-error")
                },
                success: function(e) {
                    e.closest(".form-group").removeClass("has-error")
                },
                errorClass: "help-block m-b-none",
                rules:{
                    status:{required:true}
                }
            });
       });
    </script>
</block>
<block name="content">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>编辑模型 - [ {$model->name} ] </h5>
                        <div class="ibox-tools">
                            <a href="javascript:history.go(-1);" class="btn btn-outline btn-info btn-xs">
                                <i class="fa fa-arrow-circle-left"></i> 返回
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form method="post" action="" class="form-horizontal" id="checkForm">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">模型名</label>
                                <div class="col-sm-10">
                                    <input type="text" name="name" value="{$model->name}" required class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">操作表</label>
                                <div class="col-sm-10">
                                    <input type="text" name="tablename" value="{$model->tablename}" required class="form-control">
                                    <span class="help-block m-b-none">表名小写，去掉默认表前缀</span>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">排序</label>
                                <div class="col-sm-10">
                                    <input type="text" name="sort" value="{$model->sort}" required class="form-control">
                                    <span class="help-block m-b-none">倒排序,意味着数字越大排序也高！</span>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">模型简介</label>
                                <div class="col-sm-10">
                                    <textarea  name="description" class="form-control">{$model->description}</textarea>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">状态
                                    <!--<br/><small class="text-navy">自定义样式</small>-->
                                </label>
                                <div class="col-sm-10">
                                    <div class="radio i-checks">
                                        <label>
                                            <input type="radio" value="1" <eq name="model.status" value="1">checked</eq> name="status">
                                            <i></i>
                                            正常
                                        </label>
                                    </div>
                                    <div class="radio i-checks">
                                        <label>
                                            <input type="radio" value="0" <eq name="model.status" value="0">checked</eq> name="status"> <i></i> 禁用</label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    {:token()}
                                    <button class="btn btn-primary" type="submit">保存</button>
                                    <button class="btn btn-primary" type="reset">重置</button>
                                    <button class="btn btn-primary" type="button" onclick="history.go(-1)">返回</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</block>